﻿using System;
using System.Net.Mail;

namespace NC.Models
{
    public class Email
    {
        private readonly MailMessage _message;

        private readonly SmtpClient _emailClient;

        public Email(MailMessage message)
        {
            _emailClient = new SmtpClient();
            _message = message;
        }

        /// <summary>
        /// This will send the email message using the email Client
        /// </summary>
        public bool Send()
        {
            try
            {
                _emailClient.Send(_message);
                return true;
            }
            catch (Exception)
            {
                //error sending email
                return false;
            }
        }
    }
}
